import Mock from "mockjs";
let data = [];
for (let i = 0; i <= 200; i++) {
  data.push({
    id: Mock.mock("@id"),
    WeChat: Mock.mock("@email"),
    phone: Mock.mock("@zip()"),
    CourseName: Mock.mock("@ctitle()"),
    money: Mock.mock("@natural(20, 100)"),
    time: Mock.mock("@datetime"),
    status: Mock.mock("@natural(0,4)"),
  });
}

export default {
  getHomeData(config) {
    console.log("后端", config);
    let transformJSON = JSON.parse(config.body);
    // console.log("传过来的数据的值:", transformJSON.search.input);
    let searchFilter = data.filter((val) => {
      return val.WeChat.indexOf(transformJSON.search.input) != -1;
    });
    // console.log(searchFilter);
    return {
      code: 200,
      msg: "数据请求成功",
      data: searchFilter,
    };
  },
};
